﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace jcs.Core
{
    public class StringProvider
    {

        public static Boolean StringIsOfLength(int length, params string[] strings) {

            Boolean ReturnValue = false;
            var FoundIt = strings.FirstOrDefault(c => c.Length == length);
            if (FoundIt != null) { ReturnValue = true; }
            return ReturnValue;

        }

        public static string ConcentrateString<T>(List<T> values, string seperator = "")
        {

            if (values == null || values.Count == 0) {return null;}
            var Builder = new StringBuilder();
            values.ForEach(v => Builder.Append(String.Concat(v.ToString(), seperator)));
            if (seperator != string.Empty && Builder.Length > 0)
            {
                Builder.Remove((Builder.Length - 1), 1); //remove trailing seperator
            }
            return Builder.ToString();
        }
    }
}
